var results = '';

var request = require('request');

var chat = function(content, userid) {

	var options = {
	  url: encodeURI('http://www.tuling123.com/openapi/api?key=2128bcb5211b04332dd30b33624efa58' + '&userid=' + userid + '&info=' + content),
	 /* headers: {
	    'apiKey': '7fe470e503e234f1c9d98c5e8dc74b60'
	  }*/
	};
	
	function callback(error, response, body) {
	  if (!error && response.statusCode == 200) {
	    var info = JSON.parse(body);
	    //console.log(info);
	    results = info.text;
	  }
	  
	  return false;
	}
	
	request(options, callback);
	
	return results;
	
}

module.exports = chat;

